package dk.almbrand.microservice.circuitbreaker;

import java.util.concurrent.Callable;

public interface CircuitBreaker {
	public boolean isClosed();
	public boolean isOpen();
	public boolean isHalfOpen();
	public void moveToClosedState();
	public void moveToOpenState();
	public void moveToHalfOpenState();
	public void increaseFailureCount();
	public void resetFailureCount();
	public void prepareFailureCountForHalfOpen();
	public boolean thresholdReached();
	public void close();
	public void open();
	public int getThreshold();
	public long getTimeoutNanoSeconds();
	
	@SuppressWarnings("rawtypes")
	public <T> T doAction(Callable callable, Class<T> type);
	public void doAction(Runnable runnable);
}
